import XLSX from 'xlsx'
/**
 * 
 * @param {Object} file  input:file获取的单个文件对象
 * @param {Function} callback 回调函数
 */
export function readExcel(file, callback) {
	var reader = new FileReader();
	reader.onload = function(e) {
		var data = e.target.result;
		var workbook = XLSX.read(data, {type: 'binary'});
		if(callback) callback(workbook);
	};
    reader.readAsBinaryString(file);
    
}
/**
 * 
 * @param {Object} sheet workbook.Sheets['SheetName']
 */
export function sheetToJSON(sheet){
    return XLSX.utils.sheet_to_json(sheet)
}